﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "教学任务安排 - 体育项目");
		
		termID = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		currentTab = event.getArg("TabID", "labCourse");
		
		sql = "SELECT 
					t_course.cid, 
					t_course.course_name, 
					t_course.course_credit, 
					t_course.period_week, 
					t_course.period, 
					t_course.period_theory, 
					t_course.period_practice, 
					t_course.course_code, 
					(SELECT COUNT(*) 
						FROM 
							t_sport_task 
						WHERE t_sport_task.term_id = :termId 
							  AND t_sport_task.cid = t_course.cid 
							  AND SUBSTR(t_sport_task.task_prop, 7, 1) = '0'
					) countSportTask 
				FROM 
					t_course 
				WHERE 
					(t_course.cat_id = 'S2')
					AND 
					t_course.abandon = '0' 
			   ORDER BY 
					t_course.cat_id, t_course.course_name ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
		rs_course = queryObj.execute( sql=sql ).getResult(); 
				
		taskCount = 0;
		
		for ( i=1; i LTE rs_course.recordCount; i++ ) {
			taskCount += rs_course["countSportTask"][i];
		}
		
		passArgs = structNew();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">教学任务安排</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>体育项目课
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCourse">class="active"</cfif> id="labCourse" tabTarget="Course">课程开设情况</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Course" class="tabContent">
					
					<div class="noticeBlock">
						<h3>体育项目课程开设情况</h3>
						<p><span class="img icon16x16 message"></span><em><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput></em>学期, 已计划开设 <em><cfoutput>#taskCount#</cfoutput></em> 个体育项目授课班级.</p>
						<hr/>
					</div>
					
					<cfif rs_course.recordCount>
						
						<cfset row = 0 />
						<table class="UIEditable">
							<thead>
								<tr>
									<td width="18"></td>
									<td>课程</td>
									<td width="100">课程号</td>
									<td width="25">学分</td>
									<td width="70">排课周学时</td>
									<td width="40">总学时</td>
									<td width="50">理论学时</td>
									<td width="50">实践学时</td>
									<td width="50">教学班</td>
									<td width="18"></td>
								</tr>
							</thead>
							<tbody>
								<cfloop query="rs_course">
									<cfset row++ />
									<cfset structInsert(passArgs, "CID", rs_course.cid, true) />
									<tr class="editRows" rowid="<cfoutput>#rs_course.cid#</cfoutput>">
										<td class="index"><cfoutput>#row#</cfoutput></td>
										<td><cfoutput>#rs_course.course_name#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_course.course_code#</cfoutput></span></td>
										<td align="center"><span class="numeric"><cfoutput>#numberFormat(rs_course.course_credit, '_.__')#</cfoutput></span></td>
										<td align="center"><span class="numeric"><cfoutput>#rs_course.period_week#</cfoutput></span></td>
										<td align="center"><span class="numeric"><cfoutput>#rs_course.period#</cfoutput></span></td>
										<td align="center"><cfif rs_course.period_theory><span class="numeric"><cfoutput>#rs_course.period_theory#</cfoutput></span></cfif></td>
										<td align="center"><cfif rs_course.period_practice><span class="numeric"><cfoutput>#rs_course.period_practice#</cfoutput></span></cfif></td>
										<td align="center"><span class="numeric"><cfif rs_course.countSportTask><cfoutput>#rs_course.countSportTask#</cfoutput><cfelse>-</cfif></span></td>
										<td><a title="课程开设情况" href="<cfoutput>#buildURL('sportTaskByCourse', passArgs)#</cfoutput>" class="stat <cfif rs_course.countSportTask gt 0>running<cfelse>stop</cfif>"></a></td>
									</tr>
								</cfloop>
							</tbody>
						</table>
						
						<cfelse>
						
						<div class="systemNotice">
							<p>课程代码库中未设置任何小语种课程, 请正确设置小语种课程的课程类别</p>
						</div>
						
					</cfif>
					
				</div>
			
			
			</div>
		</li>
	</ul>
</div>